<template>
	<view class="page" :class="getThemeClass">
		<!-- 我的NFT藏品 -->
		<!-- <unavbar title="我的藏品"></unavbar> -->
		<!-- 藏品数据 -->
		<view class="coll-head">
			<view class="header">
				<image :src="`/static/images/9.png`" class="header-bg-image" mode="widthFix"></image>
				<image :src="`/static/images/21.png`" class="w100" style="height:348rpx" ></image>
				<!-- <image :src="`/static/images/my/${getThemeName}/my_bg.png`" class="header-bg-image" mode="widthFix"></image> -->
				<!-- <view class="header-content">
					<view class="u-flex align-center u-m-t-20">
						<u-avatar :src="information.avatar" size="180"></u-avatar>
						<view class="u-m-l-30">
							<view class="u-m-t-0">
								<text class="u-font-38 u-m-r-20">{{information.nickname}}</text>
							</view>
							<view class="u-m-t-20 u-m-b-60 id-tab-no-bg">
								<view class="u-font-24 text-content line-1">
									<text>区块地址：</text>
									<text>{{information.account || '暂无'}}</text>
								</view>
							</view>
						</view>
					</view>
				</view> -->
			</view>
			<!-- <u-tabs
				:list="tabs" 
				:is-scroll="false" 
				:current="current" 
				@change="change" 
				:show-bar="false"
				active-color="#73F6A2" 
				:inactive-color="getNavInactiveColor" 
				:bg-color="getBgColor"
			></u-tabs> -->
		</view>
		<!-- <view class="Dividingline"></view> -->
		
		<view class="featured">
			<!-- <view class="featured_item black-bg" v-for="(item, index) in featuredList" :key="index" @click="godetail(item.id)">
				<view style="position: relative;">
					<view class="cover_box">
						<image :src="item.cover" mode="aspectFit"></image>
						<view class="cover-bottom card-bg"></view>
					</view>
				</view>
				<view class="featured_content flex justify-between align-center">
					<view class="size-28">
						<view class="text-bold line-1 flex-1">{{ item.title }}</view>
						<view class="text-bold" style="color: #f7924c;">x {{item.count}}</view>
						<view class="u-m-t-5">
							<text class="text-tips z-font-22">x{{item.count}}</text>
						</view>
					</view>
					<view style="color: #E21362;">
						<text>￥</text>
						<text class="size-44">{{item.price}}</text>
					</view>
				</view>
			</view> -->
			<view class="t1 u-m-b-38">我的服务</view>
			<view class="bg1">
				<!-- <image :src="`/static/images/20.png`"  mode="widthFix"></image> -->
				<view @click="$u.route('/pages/tabbar/home/competition')">
					<image src="/static/images/17.png"></image>
					AIGC创作大赛
				</view>
				<view @click="$u.route('/pages/my/collections/creating')">
					<image src="/static/images/16.png"></image>
					创作藏品
				</view>
				<view @click="$u.route('/pages/my/customization/physical')">
					<image src="/static/images/10.png"></image>
					个性化实物定制
				</view>
			</view>
			<view  v-if="false">
				<view class="bg2 flex justify-between align-center">
					<!-- <image :src="`/static/images/20.png`"  mode="widthFix"></image> -->
					<view>
						<image src="/static/images/17.png"></image>
						AIGC创作大赛
					</view>
					<view>
						<image src="/static/images/16.png"></image>
						创作藏品
					</view>
					<view>
						<image src="/static/images/10.png"></image>
						个性化实物定制
					</view>
				</view>
				<view class="bg2 flex justify-between align-center">
					<!-- <image :src="`/static/images/20.png`"  mode="widthFix"></image> -->
					<view>
						<image src="/static/images/17.png"></image>
						AIGC创作大赛
					</view>
					<view>
						<image src="/static/images/16.png"></image>
						创作藏品
					</view>
					<view>
						<image src="/static/images/10.png"></image>
						个性化实物定制
					</view>
				</view>
				<view class="bg2 flex justify-between align-center">
					<!-- <image :src="`/static/images/20.png`"  mode="widthFix"></image> -->
					<view>
						<image src="/static/images/17.png"></image>
						AIGC创作大赛
					</view>
					<view>
						<image src="/static/images/16.png"></image>
						创作藏品
					</view>
					<view>
						<image src="/static/images/10.png"></image>
						个性化实物定制
					</view>
				</view>
			</view>
			
		</view>
		<!-- <empty v-if="!featuredList.length"></empty> -->
		<!-- <uni-load-more :status="loadStatus" v-if="featuredList.length>0"></uni-load-more> -->
		<u-mask :show="show" @click="umaskCli" :mask-click-able="true"></u-mask>
		<u-toast ref="uToast" />
		<u-tabbar
		:list="tabbar" 
		:mid-button="true" 
		:border-top="false"
		inactive-color="#798387"
		active-color="#CAFD5C"
		mid-button-size = "135"
		bg-color="#242424">
		</u-tabbar>
	</view>
</template>

<script>
	import {
		tabbar
	} from "@/common/tabbar.js"
	export default {
	data() {
		return {
			popupId: null,
			show: false,
			tabbar: tabbar,
			featuredList: [],
			page: 1,
			limit: 10,
			plat_free: 0,

			loadStatus: 'noMore',

			tabs: [{
				name:'藏品',
				id:0
			},{
				name:'盲盒',
				id:1
			}],
			current: 0,
			information:[]
		};
	},
	created() {
		
	},
	onShow() {
		this.myObject(true);
	},
	onPullDownRefresh() {
		this.myObject(true);
	},
	onReachBottom() {
		if (this.loadStatus == 'noMore') return;
		this.page++;
		this.myObject();
	},
	methods: {
		godetail(id){
			uni.navigateTo({
				url: `/pages/my/collections/collections-detail?id=${id}&type=${this.current}`
			})
		},
		change(index) {
			if(this.current==index)return
			this.current = index;
			this.myObject(true)
		},
		myObject(flag) {
			if (flag) this.page = 1;

			this.$u.api
				.my_shai({
					page: this.page,
					type:this.tabs[this.current].id
				})
				.then(res => {
					if (res.code == 200) {
						this.information = res.data.info
						this.featuredList = flag ? res.data.list.data : this.featuredList.concat(res.data.list.data);
						this.loadStatus = res.data.list.next_page_url ? 'more' : 'noMore';
						this.plat_free = res.data.plat_free;
						uni.stopPullDownRefresh()
					}
				})
				.catch(err => {});
		},
		// 跳转商品详情页面
		go_commodityDef(id) {
			uni.navigateTo({
				url: '/pages/market/goods-def/goods-def?id=' + id
			});
		},
		likeCli(id) {
			this.featuredList.some(item => {
				if (item.id == id) {
					if (item.like) {
						item.like = false;
					} else {
						item.like = true;
					}
					return true;
				}
			});
		},
		// 弹出框-更多
		moreCli(id) {
			this.popupId = id;
			this.show = true;
		},
		// 流转
		goUp(item) {
			if (item.type == 0) {
				this.$refs.uToast.show({
					title: '该藏品处于冷却状态',
					type: 'error'
				});
			} else {
				uni.navigateTo({
					url: '../go-up/go-up?item=' + JSON.stringify(item) + '&fee=' + this.plat_free
				});
			}
			this.show = false;
		},
		// 拍卖
		auction(item) {
			uni.navigateTo({
				url: '../auction/auction?item=' + JSON.stringify(item)
			});
			this.show = false;
		},
		// 点击遮罩层
		umaskCli() {
			if ((this.show = true)) {
				this.show = false;
				if (this.popupId != null) {
					this.popupId = null;
				}
			}
		}
	}
};
</script>

<style lang="scss" scoped>
.bg1{
	background:url(../../../static/images/20.png);
	background-position: center;
    background-repeat: no-repeat;
    background-size: 100% 100%;
	font-size: 24rpx;
	font-family: PingFang SC-Bold, PingFang SC;
	font-weight: bold;
	color: #FFFFFF;
	line-height: 19rpx;
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 28rpx 30rpx 50rpx 30rpx;
	margin-bottom: 10rpx;
}
.bg1 view{width: 33.33%;text-align: center;}
.bg1 image{width: 60rpx;height: 60rpx;display: block;margin-left: auto;margin-right: auto;margin-bottom: 20rpx;}
.bg2{margin-top: 30rpx;}
.bg2 view{
	width: 210rpx;
	text-align: center;
	background: #212121;
	border-radius: 20rpx 20rpx 20rpx 20rpx;
	opacity: 1;
	font-size: 24rpx;
	font-family: PingFang SC-Medium, PingFang SC;
	font-weight: 500;
	color: #FFFFFF;
	line-height: 19rpx;
	padding-bottom: 36rpx;
	padding-top: 36rpx;
}
.bg2 image{width: 60rpx;height: 60rpx;display: block;margin-left: auto;margin-right: auto;margin-bottom: 20rpx;}
.bg1 view:nth-child(2){border-left: 2rpx solid rgba(202,253,92,0.2);border-right: 2rpx solid rgba(202,253,92,0.2);box-sizing: border-box;}
.t1{
	font-size: 32rpx;
	font-family: PingFang SC-Medium, PingFang SC;
	font-weight: 500;
	color: #FFFFFF;
	line-height: 38rpx;
}
.page{
		padding-top: 0;
	}
	.header {
		position: relative;
		padding: calc(var(--status-bar-height) + 30rpx) 30rpx 0rpx;
		z-index: 0;
		.header-bg-image{
			position: absolute;
			top: 0;
			left: 0;
			z-index: -1;
			width: 100%;
		}
		
		.header-content{
			position: relative;
			z-index: 1;
			.u-flex{
				text-align: center;
				flex-direction: column;
				justify-content: center;
				.id-tab-no-bg{
					width: 437rpx;
					height: 66rpx;
					line-height: 66rpx;
					text-align: center;
					border-radius: 50rpx;
					background: #1E1E1E;
					box-shadow: inset -3rpx -3rpx 5rpx 0rpx rgba(208, 0, 180, 0.2),inset 3rpx 3rpx 10rpx 0rpx #004A21;
					.text-content{
						width: 100%;
						padding: 0 20rpx;
					}
				}
			}
		}
	}
	.coll-head{
		width: 750rpx;
		position: fixed;
		// top: calc(44px + var(--status-bar-height));
		// left: 0;
		z-index: 10;
		background-color: #000000;
	}
	.Dividingline{
		box-shadow: 0rpx 15rpx 20rpx 2rpx rgba(134, 249, 175, 0.3);
		height: 530rpx;
	}
// .page-black {
// 	background-color: #1e2020;

// 	.featured_item {
// 		background-color: #292b2b !important;
// 		border-top-left-radius: 20rpx;
// 		border-top-right-radius: 20rpx;
// 	}

// 	.featured {
// 		background-color: #1e2020;

// 		.featured_content {
// 			background-color: #292b2b !important;
// 			color: #FFFFFF;

// 			.cont_title {
// 				color: #ffffff !important;
// 			}

// 			.cont_price {
// 				color: #f7924c !important;
// 			}
// 		}
// 	}
// }

.featured {
	padding: 30rpx 30rpx 0 30rpx;
//	display: flex;
//	flex-wrap: wrap;
//	justify-content: space-between;
	padding-top:450rpx;
	.featured_item {
		width: 334rpx;
		height: 480rpx;
		margin-bottom: 20rpx;
		position: relative;
		box-shadow: 0rpx 5rpx 15rpx 2rpx rgba(115, 246, 162, 0.3);
		// background-color: #fff;
		// border-bottom-left-radius: 30rpx;
		// border-bottom-right-radius: 30rpx;
		display: flex;
		flex-direction: column;
		justify-content: space-between;

		.cover_box {
			width: 336rpx;
			height: 336rpx;
			overflow: hidden;
			display: flex;
			align-items: center;
			position: relative;

			image {
				width: 100%;
			}
		}

		.featured_content {
			// background-color: #fff;
			padding: 0 20rpx 20rpx 20rpx;

			.cont_title {
				// color: #111111;
				font-size: 28rpx;
				font-weight: bold;
				padding: 30rpx 0 0 24rpx;
			}

			.cont_price {
				// color: red;
				font-size: 34rpx;
				font-weight: bold;
				padding: 30rpx 0 0 24rpx;

				text {
					font-size: 22rpx;
				}
			}

			.cont_bot {
				display: flex;
				align-items: center;
				justify-content: space-between;
				padding: 46rpx 30rpx 28rpx 32rpx;

				.more {
					display: flex;

					.more_item {
						width: 8rpx;
						height: 8rpx;
						// background-color: #999999;
						border-radius: 50%;
						margin-right: 6rpx;
					}
				}
			}

			.con_popup {
				width: 186rpx;
				// height: 326rpx;
				// background-color: #fff;
				border-radius: 10rpx;
				position: absolute;
				// top: 340rpx;
				bottom: 20rpx;
				left: 34rpx;
				z-index: 99999;
				line-height: 3;
				padding-left: 40rpx;
				font-size: 26rpx;
				// color: #333333;
				font-weight: bold;
			}
		}

		.like {
			width: 46rpx;
			height: 46rpx;
			border-radius: 50%;
			position: absolute;
			top: 20rpx;
			right: 20rpx;
			// background-color: #fff;
			text-align: center;
			line-height: 46rpx;
			image {
				width: 26rpx;
			}
		}
	}
}

.tags {
	position: absolute;
	bottom: 20rpx;
	right: 20rpx;
	color: #ffffff;
	font-size: 20rpx;
}

.cover-bottom{
	width: 100%;
	height: 30rpx;
	position: absolute;
	left: 0;
	bottom: 0;
	border-radius: 0rpx 50rpx 0rpx 0rpx;
}
</style>
